package com.luli.service.impl;

import com.luli.Utils.PojoUtil;
import com.luli.constant.Dict;
import com.luli.dao.BigScreenDataDao;
import com.luli.service.BigScreenService;
import lombok.extern.slf4j.Slf4j;
import org.apache.shiro.crypto.hash.Hash;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import static com.luli.Utils.PojoUtil.isLegalDate;

/**
 * 陆离
 * 2022/11/15 9:04:53
 */
@Service
@Slf4j
public class BigScreenServiceImpl implements BigScreenService {
    @Autowired
    private BigScreenDataDao bigScreenDataDao;
    /***
     * 大屏数据查询
     * @param date
     * @return
     */
    @Override
    public List<BigScreenDataDao> queryBigScreenData(String date) {
        Map<String, Object> paramMap = new HashMap<>();

        //不为空判断日期格式
        if (!PojoUtil.isEmpty(date)){
            //检验日期是否合法
            boolean dateCode = isLegalDate(date.length(), date, "yyyyMMdd");
            //查询数据进行返回
            if (dateCode) {
                paramMap.put(Dict.DATE,date) ;
            }
        }
        return bigScreenDataDao.queryBigScreenData(paramMap);
    }


}
